#include <stdio.h>

struct date
{
    int year;
    int month;
    int day;
};

int calculate(const struct date *someday)
{
    int days1[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int days2[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    int sum = 0;

    for(int i=0; i<someday->month-1; i++)
    {
        if((someday->year%4==0 && someday->year%100!=0) ||
            someday->year%400==0)
            sum += days2[i];
        else
            sum += days1[i];
    }

    sum += someday->day;
    return sum;
}

int main(int argc, char const *argv[])
{
    printf("请输入一个日期(格式为：2024/07/10): ");

    struct date someday;
    scanf("%d/%d/%d", &someday.year, &someday.month, &someday.day);

    printf("这是%d中的第%d天\n", someday.year, calculate(&someday));

    return 0;
}
